cmake_minimum_required(VERSION 3.18.1)

add_library(
        android_jni
        SHARED
        src/main/cpp/jni/test_jni.cpp
        src/main/cpp/jni/gpio_jni.cpp
        src/main/cpp/jni/uart_jni.cpp
        src/main/cpp/common/common.cpp
        src/main/cpp/gpio/sysfs_gpio.cpp
        src/main/cpp/pwm/sysfs_pwm.cpp
        src/main/cpp/uart/dev_uart.cpp
)

add_library(
        android_i2c_jni
        SHARED
        src/main/cpp/jni/i2c_jni.cpp
        src/main/cpp/i2c/main.cpp
        src/main/cpp/i2c/lib/BME280/BME280.cpp
        src/main/cpp/i2c/lib/I2C/I2C.cpp
        src/main/cpp/i2c/lib/IMU/ICM20948.cpp
        src/main/cpp/i2c/lib/IMU/IMU.cpp
        src/main/cpp/i2c/lib/IMU/MPU9250.cpp
        src/main/cpp/i2c/lib/LTR390/LTR390.cpp
        src/main/cpp/i2c/lib/SGP40/SGP40.cpp
        src/main/cpp/i2c/lib/TSL2591/TSL2591.cpp
)

# 链接其他库（如 log）
find_library(log-lib log)
target_link_libraries(android_jni ${log-lib})
target_link_libraries(android_i2c_jni ${log-lib})